package com.sky.controller.admin;

import com.sky.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/shop")
public class ShopController {
    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    @PutMapping("/{status}")
    public Result updateStatus(@PathVariable Integer status){
        redisTemplate.opsForValue().set("status",Integer.toString(status));
        return Result.success();
    }

    @GetMapping("/status")
    public Result getStatus(){
        return Result.success(Integer.parseInt(redisTemplate.opsForValue().get("status")));
    }
}
